<template>
	<div>
		<!--<el-tabs v-model="activeName" @tab-click="handleClick">
			<el-tab-pane label="发票列表" name="first">-->
		<el-row :gutter="24" v-if="tableFlog">
			<el-col :span="24">
				<el-row :gutter="24">
					<el-col :span="1" style="margin-right:10px;">
						<p class="queryLabel">发票日期:</p>
					</el-col>
					<el-col :span="3">
						<el-date-picker v-model="data.firstStart" size="small" style="width:100%;" type="date" clearable placeholder="发票日期">
						</el-date-picker>
					</el-col>
					<el-col :span="1" style="text-align: left;margin-left: 0px;">
						<p class="queryLabel">至:</p>
					</el-col>
					<el-col :span="3">
						<el-date-picker v-model="data.firstStarts" size="small" style="width:100%;" type="date" clearable placeholder="发票日期">
						</el-date-picker>
					</el-col>
					<el-col :span="1" style="text-align: left;margin-left: 0px;">
						<p class="queryLabel">发票号:</p>
					</el-col>
					<el-col :span="3">
						<el-input size="small" v-model="conditions.inputName" placeholder="请输入发票号">
						</el-input>
					</el-col>
					<el-col :span="1" style="text-align: left;margin-left: 0px;">
						<p class="queryLabel">VIN:</p>
					</el-col>
					<el-col :span="3">
						<el-input size="small" v-model="conditions.vin" placeholder="请输入VIN">
						</el-input>
					</el-col>
					<el-col :span="7">
						<el-button type="primary" size="small" @click="cleans">清空查询条件</el-button>
						<el-button type="primary" size="small" v-on:click='companyQuery'>查询</el-button>
						<el-button type="primary" size="small" v-on:click='add'>新增</el-button>
						<el-button type="primary" size="small" v-on:click='edit'>修改</el-button>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<el-table :data="tableData.dataList" border style="width: 100%;align-content: center;" :row-class-name="tableRowClassName" @selection-change="handleSelectionChangeIn">
							<el-table-column type="selection" width="55" label="选择" fixed></el-table-column>
							<el-table-column label="发票编号" prop="invoiceNum">
							</el-table-column>
							<el-table-column label="关联发票" prop="relationNum">
							</el-table-column>
							<el-table-column label="发票日期" align="right" prop="invoiceDate1">
							</el-table-column>
							<el-table-column label="录入人员" align="right" prop="inputName">
							</el-table-column>
							<el-table-column label="总金额" align="right" prop="invoiceTempTotal">
							</el-table-column>
							<el-table-column label="发票金额" align="right" prop="invoiceTotal">
							</el-table-column>
							<el-table-column label="红冲金额" align="right" prop="invoiceRedMoney">
							</el-table-column>
							<el-table-column label="发票单位" align="right" prop="invoiceUnit">
							</el-table-column>
							<el-table-column label="发票类型" align="right" prop="invoiceType" :formatter="invoiceTypeCov">
							</el-table-column>
							<el-table-column label="操作" align="right" width="80">
								<template scope="scope">
									<el-tooltip class="item" effect="light" content="车辆列表" placement="top">
										<el-button type="primary" size="mini" icon="setting" @click.native.prevent="info(scope.$index)"></el-button>
									</el-tooltip>
								</template>
							</el-table-column>
						</el-table>
						<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableData.total">
						</el-pagination>
					</el-col>
				</el-row>
			</el-col>
		</el-row>
		<el-row :gutter="24" v-if="!tableFlog">
			<el-col :span="24">
				<el-row :gutter="24">
					<el-col :span="1">
						<p class="queryLabel">发票编号:</p>
					</el-col>
					<el-col :span="4">
						<el-input size="small" v-model="condition.invoiceNum" placeholder="" readonly>
						</el-input>
					</el-col>
					<el-col :span="1">
						<p class="queryLabel">录入人员:</p>
					</el-col>
					<el-col :span="4">
						<el-input size="small" v-model="condition.inputName" placeholder="" readonly>
						</el-input>
					</el-col>
					<el-col :span="1">
						<p class="queryLabel">发票日期:</p>
					</el-col>
					<el-col :span="4">
						<el-input size="small" v-model="condition.invoiceDate" placeholder="" readonly>
						</el-input>
					</el-col>
					<el-col :span="7" style="padding-left: 0px;text-align: right">
						<!--<el-button type="primary" size="small" v-on:click='invoiceCarQuery'>查询</el-button>-->
						<el-button type="primary" size="small" v-on:click='addCar'>添加车辆</el-button>
						<el-button type="primary" size="small" v-on:click='addCars'>添加上月车辆</el-button>
						<el-button type="primary" size="small" v-on:click='removeCar'>移除</el-button>
						<el-button type="primary" size="small" v-on:click='esitPrice'>修改金额</el-button>
					</el-col>
					<el-col :span="2" style="padding-left: 0px;text-align: right">
						<el-button type="primary" icon="caret-left" size="small" v-on:click='buckList'>返回</el-button>
					</el-col>
				</el-row>
				<el-row :gutter="24">
					<el-col :span="1">
						<p class="queryLabel">总金额:</p>
					</el-col>
					<el-col :span="4">
						<el-input size="small" v-model="condition.invoiceTempTotal" placeholder="" readonly>
						</el-input>
					</el-col>
					<el-col :span="1">
						<p class="queryLabel">发票金额:</p>
					</el-col>
					<el-col :span="4">
						<el-input size="small" v-model="condition.invoiceTotal" placeholder="" readonly>
						</el-input>
					</el-col>
					<el-col :span="12" style="padding-left: 0px;text-align: right">
						<!--<el-button type="primary" size="small" v-on:click='addRed'>增加红票</el-button>
						<el-button type="primary" size="small" v-on:click='addRedAll'>增加整冲红票</el-button>-->
						<el-button type="primary" size="small" v-on:click='prientOrder(0)'>打印冲估单</el-button>
						<el-button type="primary" size="small" v-on:click='prientOrder(2)'>打印冲正入单</el-button>
						<el-button type="primary" size="small" v-on:click='prientOrder(1)'>打印入库单</el-button>
					</el-col>
					<el-col :span="24">
						<el-collapse v-model="activeName">
							<el-collapse-item title="查询条件" name="1">
								<el-row :gutter="24">
									<el-col :span="1" style="margin-right:10px;">
										<p class="queryLabel">VIN:</p>
									</el-col>
									<el-col :span="4">
										<el-input size="small" v-model="sel_vin" placeholder="请输入VIN">
										</el-input>
									</el-col>
									<el-col :span="1" style="padding-left: 0px;">
										<el-button type="primary" size="small" v-on:click='invoiceCarQuery'>查 询</el-button>
									</el-col>
								</el-row>
							</el-collapse-item>
						</el-collapse>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<el-table :data="tableDatas.dataList" border style="width: 100%;align-content: center;" @selection-change="handleSelectionChanges" :row-class-name="tableRowClassNames">
							<el-table-column type="selection" width="60">
							</el-table-column>
							<el-table-column label="VIN" prop="vin" width="180">
							</el-table-column>
							<el-table-column label="暂估成本" align="right" prop="estimatePrice" width="100">
							</el-table-column>
							<el-table-column label="发票金额" align="right" prop="carPrice" width="100">
							</el-table-column>
							<el-table-column prop="purchaseNum" label="采购单号" width="100">
							</el-table-column>
							<el-table-column prop="purchaseDate1" label="采购日期" width="120">
							</el-table-column>
							<el-table-column label="车型" align="right" prop="modelName" width="150">
							</el-table-column>
							<el-table-column prop="carModelCode" label="车型代码" width="100">
							</el-table-column>
							<el-table-column prop="modelName" label="车型名称" width="150">
							</el-table-column>
							<el-table-column prop="configureCode" label="配置代码" width="150">
							</el-table-column>
							<el-table-column prop="configureName" label="配置名称" width="150">
							</el-table-column>
							<el-table-column prop="carModelYear" label="车型年" width="100">
							</el-table-column>
							<el-table-column prop="appearanceCode" label="外观代码" width="100">
							</el-table-column>
							<el-table-column prop="appearanceName" label="外观颜色" width="120">
							</el-table-column>
							<el-table-column prop="trimCode" label="内饰代码" width="100">
							</el-table-column>
							<el-table-column prop="trimName" label="内饰名称" width="100">
							</el-table-column>
							<el-table-column prop="chooseCode" label="加装代码" width="100">
							</el-table-column>
							<el-table-column prop="chooseName" label="加装名称" width="100">
							</el-table-column>
						</el-table>
						<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChanges" :current-page="CurentPages" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableDatas.total">
						</el-pagination>
					</el-col>
				</el-row>
			</el-col>
		</el-row>

		<el-dialog title="发票新增" v-model="comFormShow" size="tiny">
			<el-form :model="comFormData" ref="comForm" :rules="Rule" label-width="150px">
				<el-col :span="24">
					<el-form-item label="发票编号：" prop="invoiceNum" required>
						<el-input size="small" v-model="comFormData.invoiceNum"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="发票日期：" prop="invoiceDate" required>
						<el-date-picker v-model="comFormData.invoiceDate" size="small" style="width:100%;" type="date" clearable placeholder="发票日期">
						</el-date-picker>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<!--修改 发票金额不含税-->
					<el-form-item label="发票金额(不含税)：" prop="invoiceTotal" required>
						<el-input size="small" v-model="comFormData.invoiceTotal"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="发票单位：" prop="invoiceTotal" required>
						<el-input size="small" v-model="comFormData.invoiceUnit"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="发票类型：" prop="invoiceTotal" required>
						<el-select size="small" style="width: 85%; margin-left: 20px;" :disabled="invoiceTotalType" v-model="comFormData.invoiceType" placeholder="请选择类型" clearable>
							<el-option v-for="item in invoiceTypeCombo" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="comFormShow=false">取 消</el-button>
				<el-button type="primary" v-on:click='save'>提 交</el-button>
				<el-button type="primary" v-on:click='deleteSave' v-if="comFormData.invoiceType==2">删除红票车辆</el-button>
			</div>
		</el-dialog>

		<el-dialog title="整票红冲" v-model="comFormShowAll" size="tiny">
			<el-form :model="comFormData" ref="comForm" :rules="Rule" label-width="150px">
				<el-col :span="24">
					<el-form-item label="发票编号：" prop="invoiceNum" required>
						<el-input size="small" v-model="comFormData.relationNum"></el-input>
					</el-form-item>
					<!--this.$data.comFormData.relationNum-->
				</el-col>
				<el-col :span="24">
					<el-form-item label="发票日期：" prop="invoiceDate" required>
						<el-date-picker v-model="comFormData.invoiceDate" size="small" style="width:100%;" type="date" clearable placeholder="发票日期">
						</el-date-picker>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="发票金额：" prop="invoiceTotal" required>
						<el-input size="small" v-model="comFormData.invoiceTotal"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="发票单位：" prop="invoiceTotal" required>
						<el-input size="small" v-model="comFormData.invoiceUnit"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="发票类型：" prop="invoiceTotal" required>
						<el-select size="small" style="width: 85%; margin-left: 20px;" :disabled="invoiceTotalType" v-model="comFormData.invoiceType" placeholder="请选择类型" clearable>
							<el-option v-for="item in invoiceTypeCombo" :label="item.label" :value="item.value"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="comFormShowAll=false">取 消</el-button>
				<el-button type="primary" v-on:click='saveAll'>提 交</el-button>
			</div>
		</el-dialog>

		<el-dialog title="选择车辆" v-model="comFormShows" size="small">
			<el-row :gutter="24">
				<el-col :span="2">
					<p class="queryLabel">车系:</p>
				</el-col>
				<el-col :span="6">
					<el-input placeholder="请选择车系" size="small" icon="search" v-model="carModelCode" :on-icon-click="handleIconClick">
					</el-input>
				</el-col>
				<el-col :span="2">
					<p class="queryLabel">车辆型号:</p>
				</el-col>
				<el-col :span="6">
					<el-select size="small" style="width: 100%;" v-model="conditionCar.carModelCode" placeholder="请选择配置" clearable @change="changeModel">
						<el-option v-for="item in modelCombo" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-col>
				<el-col :span="2">
					<p class="queryLabel">车辆配置:</p>
				</el-col>
				<el-col :span="6">
					<el-select size="small" style="width: 100%;" v-model="conditionCar.carConfigureCode" placeholder="请选择配置" clearable>
						<el-option v-for="item in configCombo" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="2">
					<p class="queryLabel">车架号:</p>
				</el-col>
				<el-col :span="6">
					<el-input size="small" style="width: 90%;" v-model="conditionCar.vin" placeholder="请输入车架号">
					</el-input>
				</el-col>
				<el-col :span="2" style="margin-left: 10px;">
					<p class="queryLabel">提单号:</p>
				</el-col>
				<el-col :span="6">
					<el-input size="small" style="width: 90%;margin-left: 1%;" v-model="conditionCar.oldNum" placeholder="请输入单号">
					</el-input>
				</el-col>
				<el-col :span="2" style="margin-left: 10px;">
					<p class="queryLabel">车辆类型:</p>
				</el-col>
				<el-col :span="5">
					<el-select size="small" style="width: 100%;" v-model="conditionCar.isRed" placeholder="请选择配置" >
						<el-option v-for="item in typeCombo" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-col>
				<!--<el-col :span="2">
					<p class="queryLabel">入库单号:</p>
				</el-col>
				<el-col :span="6">
					<el-input size="small" style="width: 100%;" v-model="conditionCar.enterWarehouseNum" placeholder="请输入单号">
					</el-input>
				</el-col>-->
			</el-row>
			<el-row>
				<!--<el-col :span="2">
					<p class="queryLabel">车辆状态:</p>
				</el-col>
				<el-col :span="4">
					<el-select size="small" style="width: 100%;" v-model="conditionCar.status" placeholder="请选择状态" clearable>
						<el-option v-for="item in carStatus" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-col>-->

				<!--<el-col :span="3" style="padding-left: 0px;text-align: right">
					<p class="queryLabel">财务状态:</p>
				</el-col>
				<el-col :span="5">
					<el-select size="small" style="width: 100%;" v-model="conditionCar.financeType" placeholder="请选择状态" clearable>
						<el-option v-for="item in financeTypeStatus" :label="item.label" :value="item.value"></el-option>
					</el-select>
				</el-col>-->

				<el-col :span="22" style="text-align: right">
					<el-button type="primary" size="small" v-on:click='carQuery'>查询</el-button>
					<el-button type="primary" size="small" @click="clean">清空查询条件</el-button>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="24">
					<el-table :data="tableDataCar.dataList" border style="width: 100%;align-content: center;" @selection-change="handleSelectionChange" :row-class-name="tableRowClassNames">
						<el-table-column type="selection" width="60">
						</el-table-column>
						<el-table-column prop="vin" label="VIN" width="180">
						</el-table-column>
						<el-table-column prop="estimatePrice" label="暂估价格" width="100">
						</el-table-column>
						<el-table-column label="发票金额" align="right" prop="carPrice" width="100">
							<template scope="scope">
								<!--由carPrice改成invoicePrice-->
								<input v-model="scope.row.carPrice" class='table_input'>
							</template>
						</el-table-column>
						<el-table-column prop="purchaseDate1" label="采购日期" width="120">
						</el-table-column>
						<el-table-column prop="purchaseNum" label="采购单号" width="120">
						</el-table-column>
						<el-table-column prop="carSeries" label="车系名称" width="150">
						</el-table-column>
						<!--<el-table-column prop="carModelCode" label="车型代码">
						</el-table-column>-->
						<el-table-column prop="carModel" label="车型名称" width="150">
						</el-table-column>
						<el-table-column prop="configureCode" label="配置代码" width="120">
						</el-table-column>
						<el-table-column prop="configure" label="配置名称" width="100">
						</el-table-column>
						<el-table-column prop="carModelYear" label="车型年" width="100">
						</el-table-column>
						<el-table-column prop="appearanceCode" label="外观代码" width="100">
						</el-table-column>
						<el-table-column prop="appearanceName" label="外观颜色" width="130">
						</el-table-column>
						<el-table-column prop="trimCode" label="内饰代码" width="100">
						</el-table-column>
						<el-table-column prop="trimName" label="内饰名称" width="100">
						</el-table-column>
						<el-table-column prop="chooseCode" label="加装代码" width="100">
						</el-table-column>
						<el-table-column prop="chooseName" label="加装名称" width="100">
						</el-table-column>
						<el-table-column prop="distributionDate" label="配货日期" width="120">
						</el-table-column>
						<el-table-column prop="sendDate" label="发货日期" width="120">
						</el-table-column>
						<el-table-column prop="oldNum" label="提单号" width="100">
						</el-table-column>
						<el-table-column prop="distributionStatus" label="配货状态" width="100">
						</el-table-column>
						<el-table-column prop="provideCompanyName" label="购货单位" width="100">
						</el-table-column>
						<!--<el-table-column label="vin" prop="vin" width="160">
						</el-table-column>
						<el-table-column label="合格证号" align="right" prop="">
						</el-table-column>
						<el-table-column label="车辆成本" align="right" prop="purchasePrice">
						</el-table-column>
						<el-table-column label="发票金额" align="right" prop="carPrice">
							<template scope="scope">
								<input v-model="scope.row.carPrice" class='table_input'>
							</template>
						</el-table-column>
						<el-table-column label="型号" align="right" prop="carName">
						</el-table-column>
						<el-table-column label="颜色" align="right" prop="colorName">
						</el-table-column>-->
					</el-table>
					<!--<el-pagination small @size-change="handleSizeChangeCar" @current-change="handleCurrentChangeCar" :current-page="CurentPageCar" :page-size="pageCar.pageSize" layout=" total,prev, pager, next" :total="tableDataCar.total">
					</el-pagination>-->
				</el-col>
			</el-row>

			<div slot="footer" class="dialog-footer">
				<el-button @click="comFormShows=false">取 消</el-button>
				<el-button type="primary" v-on:click='saveCars' v-if="lastAdd">提 交</el-button>
				<el-button type="primary" v-on:click='saveCar' v-if="comFormData.invoiceType!=2&&!lastAdd">提 交</el-button>
				<el-button type="primary" v-on:click='deleteCar' v-if="comFormData.invoiceType==2">删 除</el-button>
			</div>
		</el-dialog>
		<el-dialog title="修改金额" v-model="editFormShow" size="tiny">
			<el-form :model="comFormDataPrice" label-width="100px">
				<el-col :span="24">
					<el-form-item label="车辆金额：" prop="price">
						<el-input size="small" v-model="comFormDataPrice.price"></el-input>
					</el-form-item>
				</el-col>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="editFormShow=false">取 消</el-button>
				<el-button type="primary" v-on:click='saveEditPrice'>提 交</el-button>
			</div>
		</el-dialog>
		<!--
        	作者：1813180149@qq.com
        	时间：2017-07-20
        	描述：打印入库单新
        -->
		<el-dialog tittl="打印" v-model="dayinFormShow" id="dvData" size="large">
			<div id="printHtml">
				<div style=" width: 100%;" v-if="dayinFormShow" v-for="(list,index) in multipleSelections">
					<div style="height: 5px;"></div>
					<font face="宋体">
						<el-row>
							<div id="" style="margin-left: 35%; width: 65%;">
								<font face="宋体">
									<div style="border-collapse:collapse;font-size: 20px;margin:0 auto;color:#000000">
										润华集团股份有限公司入库单
									</div>
								</font>
							</div>
							<div id="" style="margin-left: 0%; width: 100%; float: left;">
								&nbsp;
							</div>
							<div id="" style="margin-left: 15%; width: 20%; float: left;">
								{{moment(new Date()).format("YYYY-MM-DD")}}
							</div>
							<div id="" style="margin-left: 5%; width: 20%;float: left;">
								&nbsp;
							</div>
							<div id="" style="margin-left: 5%; width: 35%; float: left;">
								入&nbsp;{{fromWarehouseCovs2(list)}}{{printAfterNumbers[index].conncetionNo}}&nbsp;号
							</div>
							<div id="" style="margin-left: 0%; width: 100%; float: left;">
								&nbsp;
							</div>
							<div id="" style="margin-left: 5%; width: 30%; float: left;">
								收货仓库：&nbsp;{{fromWarehouseCov(list)}}
							</div>
							<div id="" style="margin-left: 45%;float: left;">
								单位：&nbsp;元
							</div>
						</el-row>
						<!--车牌号信息 开始-->
						<el-row style="padding-left:5px; margin-top:5px">
							<el-col :span="24">
								<div>
									<table width="100%" border="1px solid #F9FAFC" cellspacing="0px" cellpadding="10px" bgcolor="#F9FAFC" style="border-collapse:collapse;font-size: 10px;margin:0 auto;color:#1F2D3D">
										<tr>
											<td width="40" colspan="2"><b>供货单位</b></td>
											<td width="150" colspan="3"><b>{{list.provideCompanyName}}</b></td>
											<td width="150" colspan="3"><b>存放地点：{{fromWarehouseCov(list)}}</b></td>
											<td width="40"><b>批号</b></td>
											<td width="70"><b></b></td>
										</tr>
										<tr>
											<td rowspan="2">发票</td>
											<td width="200" rowspan="2" colspan="2">{{condition.invoiceNum}}</td>
											<td rowspan="2" colspan="2">到货日期</td>
											<td rowspan="2" colspan="2">{{list.enterWarehouseDate}}</td>
											<td rowspan="2" colspan="2">验收日期</td>
											<td rowspan="2">{{list.enterWarehouseDate}}</td>
										</tr>
										<tr>
										</tr>
										<tr>
											<td rowspan="1" colspan="3">产品名称及规格型号</td>
											<td rowspan="1" colspan="1">单位</td>
											<td rowspan="1">数量</td>
											<td rowspan="1">单价（元）</td>
											<td rowspan="1" colspan="2">金额（元）</td>
											<td rowspan="1" colspan="2">备注</td>
										</tr>
										<tr>
											<td rowspan="1" colspan="3">{{list.carSeries}}{{list.modelName}}{{list.configureName}}</td>
											<td rowspan="1" colspan="1">辆</td>
											<td rowspan="1">{{list.vin.length}}</td>
											<td rowspan="1">{{list.carPrice}}</td>
											<td rowspan="1" colspan="2">{{(Number(list.carPrice)*list.vin.length).toFixed(2)}}</td>
											<td rowspan="2" colspan="2" height="94px">
												<a v-for="(lists,index) in list.vin"><span>{{lists}}<br/></span></a>
												<!--, LWVDA2030HB048255, LWVDA2036HB048406, LWVDA2036HB047319, LWVDA203XHB048182,-->
											</td>
										</tr>
										<tr>
											<td rowspan="1" colspan="2">进货发票</td>
											<td rowspan="1" colspan="6"></td>
										</tr>
									</table>
								</div>
							</el-col>
						</el-row>
						<el-row>
							<div id="" style="margin-left: %; width: 100%; float: left;">
								&nbsp;
							</div>
							<div id="" style="margin-left: 12%; width: 15%; float: left;">
								制单：{{userName}}
							</div>
							<div id="" style="margin-left: 5%; width: 20%;float: left;">
								复核:
							</div>
							<div id="" style="margin-left: 0%; width: 15%;float: left;">
								验收员：
							</div>
							<div id="" style="margin-left: 5%; width: 15%;float: left;">
								仓库主管：
							</div>
							<el-row>
								<div>
									<div style="float: left;">
										<div>
											<!--<div style="width: 300px;">
												底盘号:&nbsp;{{list.vin}}
											</div>-->
										</div>
									</div>
								</div>
							</el-row>
						</el-row>
					</font>
					<div style="height: 120px;"></div>
				</div>

			</div>
			<!--底部的注意 结束-->
			<el-row style="margin-left:5px">
				<el-col>
					<el-button type="primary" @click="saveDayin">点击打印</el-button>
				</el-col>
			</el-row>
		</el-dialog>
		<!--冲估单dialog-->
		<el-dialog tittl="打印" v-model="dayinFormShows" id="dvData" size="large">
			<div id="printHtml">
				<div style=" width: 100%;" v-if="dayinFormShows" v-for="(list,index) in multipleSelections">
					<div style="height: 8px;"></div>
					<font face="宋体">
						<el-row>
							<div id="" style="margin-left: 35%; width: 65%;">
								<font face="宋体">
									<div style="border-collapse:collapse;font-size: 20px;margin:0 auto;color:#000000">
										润华集团股份有限公司冲估单
									</div>
								</font>
							</div>
							<div id="" style="margin-left: 0%; width: 100%; float: left;">
								&nbsp;
							</div>
							<div id="" style="margin-left: 15%; width: 20%; float: left;">
								{{(printAfterNumber[index].getStrat_printTime).substr(0,10)}}
							</div>
							<div id="" style="margin-left: 5%; width: 20%;float: left;">
								填制&nbsp;{{userName}}
							</div>
							<div id="" style="margin-left: 5%; width: 35%; float: left;">
								冲估&nbsp;{{fromWarehouseCovs2(list)}}{{printAfterNumber[index].conncetionNo}}&nbsp;号
							</div>
							<div id="" style="margin-left: 0%; width: 100%; float: left;">
								&nbsp;
							</div>
							<div id="" style="margin-left: 5%; width: 30%; float: left;">
								收货仓库：&nbsp;{{fromWarehouseCov(list)}}
							</div>
							<div id="" style="margin-left: 45%;float: left;">
								单位：&nbsp;元
							</div>
						</el-row>
						<!--车牌号信息 开始-->
						<el-row style="padding-left:5px; margin-top:5px">
							<el-col :span="24">
								<div>
									<el-row style="padding-left:5px; margin-top:5px">
										<el-col :span="24">
											<div>
												<table width="100%" border="1px solid #F9FAFC" cellspacing="0px" cellpadding="10px" bgcolor="#F9FAFC" style="border-collapse:collapse;font-size: 10px;margin:0 auto;color:#1F2D3D">
													<tr>
														<td width="40" colspan="2"><b>供货单位</b></td>
														<td width="150" colspan="3"><b>{{list.provideCompanyName}}</b></td>
														<!--表里已经删除-->
														<td width="150" colspan="3"><b>存放地点：{{fromWarehouseCov(list)}}</b></td>
														<td width="40"><b>批号</b></td>
														<td width="70"><b></b></td>
													</tr>
													<tr>
														<td rowspan="2">发票</td>
														<td width="200" rowspan="1" colspan="2">{{condition.invoiceDate}}</td>
														<td rowspan="2" colspan="2">到货日期</td>
														<td rowspan="2" colspan="2">
															{{list.enterWarehouseDate}}
														</td>
														<td rowspan="1" colspan="2">验收日期</td>
														<!--purchaseDate-->
														<td rowspan="1">{{list.enterWarehouseDate}}</td>
													</tr>
													<tr>
														<td rowspan="1" colspan="2">{{condition.invoiceNum}}</td>
														<td rowspan="1" colspan="2"></td>
														<td rowspan="1"></td>
													</tr>
													<tr>
														<td rowspan="1" colspan="3">产品名称及规格型号</td>
														<td rowspan="1" colspan="1">单位</td>
														<td rowspan="1">数量</td>
														<td rowspan="1">单价（元）</td>
														<td rowspan="1" colspan="2">金额（元）</td>
														<td rowspan="1" colspan="2">备注</td>
													</tr>
													<tr>
														<td rowspan="1" colspan="3">{{list.carSeries}}{{list.modelName}}{{list.configureName}}</td>
														<td rowspan="1" colspan="1">辆</td>
														<td rowspan="1">-{{list.vin.length}}</td>
														<td rowspan="1">{{list.estimatePrice}}</td>
														<td rowspan="1" colspan="2">-{{(Number(list.estimatePrice)*list.vin.length).toFixed(2)}}</td>
														<td rowspan="2" colspan="2" height="94px">
															<a v-for="(lists,index) in list.vin"><span>{{lists}}<br/></span></a>
															
															<!--, LWVDA2030HB048255, LWVDA2036HB048406, LWVDA2036HB047319, LWVDA203XHB048182,-->
														</td>
													</tr>
													<tr>
														<td rowspan="1" colspan="2">进货发票</td>
														<td rowspan="1" colspan="6"></td>
													</tr>
												</table>
											</div>
										</el-col>
									</el-row>
								</div>
							</el-col>
						</el-row>
						<el-row>
							<div id="" style="margin-left: %; width: 100%; float: left;">
								&nbsp;
							</div>
							<div id="" style="margin-left: 12%; width: 15%; float: left;">
								制单：{{userName}}
							</div>
							<div id="" style="margin-left: 5%; width: 20%;float: left;">
								复核:
							</div>
							<div id="" style="margin-left: 0%; width: 15%;float: left;">
								验收员：
							</div>
							<div id="" style="margin-left: 5%; width: 15%;float: left;">
								仓库主管：
							</div>
							<el-row>
								<div>
									<div style="float: left;">
										<div>
											<!--<div style="width: 300px;">
												底盘号:&nbsp;{{list.vin}}
											</div>-->
										</div>
									</div>
								</div>
							</el-row>
						</el-row>
					</font>
					<div style="height: 100px;"></div>
				</div>

			</div>
			<!--底部的注意 结束-->
			<el-row style="margin-left:5px">
				<el-col>
					<el-button type="primary" @click="saveDayin">点击打印</el-button>
				</el-col>
			</el-row>
		</el-dialog>

		<!--组合单据dialog-->
		<el-dialog tittl="打印" v-model="printAftershow" id="dvData" size="large">
			<div id="printAfterHtml" style=" width: 100%;" v-if="printAftershow">
				<div v-if="printAftershow" v-for="(list,index) in printAfterList">
					<font face="宋体">
						<!-------------------------------------------------入库单开始-->
						<div>
							<el-row>
								<div id="" style="margin-left: 35%; width: 65%;">
									<font face="宋体">
										<div style="border-collapse:collapse;font-size: 20px;margin:0 auto;color:#000000">
											润华集团股份有限公司入库单
										</div>
									</font>
								</div>
								<div id="" style="margin-left: 0%; width: 100%; float: left;">
									&nbsp;
								</div>
								<div id="" style="margin-left: 15%; width: 20%; float: left;">
									<!--{{momen	t(new Date()).format("YYYY-MM-DD")}}-->
									{{(printAfterNumbers[index].getStrat_printTime).substr(0,10)}}
									<!--左上角日期年月日-->
								</div>
								<div id="" style="margin-left: 5%; width: 20%;float: left;">
									&nbsp;
								</div>
								<div id="" style="margin-left: 5%; width: 35%; float: left;">
									入 &nbsp;{{fromWarehouseCovs2(list)}}{{printAfterNumbers[index].conncetionNo}}&nbsp;号
								</div>
								<div id="" style="margin-left: 0%; width: 100%; float: left;">
									&nbsp;
								</div>
								<div id="" style="margin-left: 5%; width: 30%; float: left;">
									收货仓库：&nbsp;{{fromWarehouseCov(list)}}
								</div>
								<div id="" style="margin-left: 45%;float: left;">
									单位：&nbsp;元
								</div>
							</el-row>
							<!--车牌号信息 开始-->
							<el-row style="padding-left:5px; margin-top:5px">
								<el-col :span="24">
									<div>
										<table width="100%" border="1px solid #F9FAFC" cellspacing="0px" cellpadding="10px" bgcolor="#F9FAFC" style="border-collapse:collapse;font-size: 10px;margin:0 auto;color:#1F2D3D">
											<tr>
												<td width="40" colspan="2"><b>供货单位</b></td>
												<td width="150" colspan="3"><b>{{list.provideCompanyName}}</b></td>
												<!--表里已经删除-->
												<td width="150" colspan="3"><b>存放地点：{{fromWarehouseCov(list)}}</b></td>
												<td width="40"><b>批号</b></td>
												<td width="70"><b></b></td>
											</tr>
											<tr>
												<td rowspan="2">发票</td>
												<td width="200" rowspan="1" colspan="2">{{condition.invoiceDate}}</td>
												<td rowspan="2" colspan="2">到货日期</td>
												<td rowspan="2" colspan="2">
													{{list.enterWarehouseDate}}
												</td>
												<td rowspan="1" colspan="2">验收日期</td>
												<!--purchaseDate-->
												<td rowspan="1">{{list.enterWarehouseDate}}</td>
											</tr>
											<tr>
												<td rowspan="1" colspan="2">{{condition.invoiceNum}}</td>
												<td rowspan="1" colspan="2"></td>
												<td rowspan="1"></td>
											</tr>
											<tr>
												<td rowspan="1" colspan="3">产品名称及规格型号</td>
												<td rowspan="1" colspan="1">单位</td>
												<td rowspan="1">数量</td>
												<td rowspan="1">单价（元）</td>
												<td rowspan="1" colspan="2">金额（元）</td>
												<td rowspan="1" colspan="2">备注</td>
											</tr>
											<tr>
												<td rowspan="1" colspan="3">{{list.carSeries}}{{list.modelName}}{{list.configureName}}</td>
												<td rowspan="1" colspan="1">辆</td>
												<td rowspan="1">{{list.vin.length}}</td>
												<td rowspan="1">{{list.estimatePrice}}</td>
												<td rowspan="1" colspan="2">{{(Number(list.estimatePrice)*list.vin.length).toFixed(2)}}</td>
												<td rowspan="2" colspan="2" height="94px">
													<a v-for="(lists,index) in list.vin"><span>{{lists}}<br/></span></a>
													<!--, LWVDA2030HB048255, LWVDA2036HB048406, LWVDA2036HB047319, LWVDA203XHB048182,-->
												</td>
											</tr>
											<tr>
												<td rowspan="1" colspan="2">进货发票</td>
												<td rowspan="1" colspan="6"></td>
											</tr>
										</table>
									</div>
								</el-col>
							</el-row>
							<el-row>
								<div id="" style="margin-left: %; width: 100%; float: left;">
									&nbsp;
								</div>
								<div id="" style="margin-left: 12%; width: 15%; float: left;">
									制单：
									<!--{{userName}}-->
								</div>
								<div id="" style="margin-left: 5%; width: 20%;float: left;">
									复核:
								</div>
								<div id="" style="margin-left: 0%; width: 15%;float: left;">
									验收员：
								</div>
								<div id="" style="margin-left: 5%; width: 15%;float: left;">
									仓库主管：
								</div>
								<el-row>
									<div>
										<div style="float: left;">
											<div>
												<!--<div style="width: 300px;">
													底盘号:&nbsp;{{multipleSelection[index].vin}}
												</div>-->
											</div>
										</div>
									</div>
								</el-row>
							</el-row>
						</div>
						<!-------------------------------------------------冲估单开始-->
						<div style="height: 125px;"></div>
						<div>
							<el-row>
								<div id="" style="margin-left: 35%; width: 65%;">
									<font face="宋体">
										<div style="border-collapse:collapse;font-size: 20px;margin:0 auto;color:#000000">
											润华集团股份有限公司冲估单
										</div>
									</font>
								</div>
								<div id="" style="margin-left: 0%; width: 100%; float: left;">
									&nbsp;
								</div>
								<div id="" style="margin-left: 15%; width: 20%; float: left;">
									{{(printAfterNumber[index].getStrat_printTime).substr(0,10)}}
								</div>
								<div id="" style="margin-left: 5%; width: 20%;float: left;">
									填制&nbsp;{{userName}}
								</div>
								<div id="" style="margin-left: 5%; width: 35%; float: left;">
									冲估&nbsp;{{fromWarehouseCovs2(list)}}{{printAfterNumber[index].conncetionNo}}&nbsp;号
								</div>
								<div id="" style="margin-left: 0%; width: 100%; float: left;">
									&nbsp;
								</div>
								<div id="" style="margin-left: 5%; width: 30%; float: left;">
									收货仓库：&nbsp;{{fromWarehouseCov(list)}}
								</div>
								<div id="" style="margin-left: 45%;float: left;">
									单位：&nbsp;元
								</div>
							</el-row>
							<!--车牌号信息 开始-->
							<el-row style="padding-left:5px; margin-top:5px">
								<el-col :span="24">
									<div>
										<table width="100%" border="1px solid #F9FAFC" cellspacing="0px" cellpadding="10px" bgcolor="#F9FAFC" style="border-collapse:collapse;font-size: 10px;margin:0 auto;color:#1F2D3D">
											<tr>
												<td width="40" colspan="2"><b>供货单位</b></td>
												<td width="150" colspan="3"><b>{{list.provideCompanyName}}</b></td>
												<td width="150" colspan="3"><b>存放地点：{{fromWarehouseCov(list)}}</b></td>
												<td width="40"><b>批号</b></td>
												<td width="70"><b></b></td>
											</tr>
											<tr>
												<td rowspan="2">发票</td>
												<td width="200" rowspan="1" colspan="2">{{condition.invoiceDate}}</td>
												<td rowspan="2" colspan="2">到货日期</td>
												<td rowspan="2" colspan="2">
													{{list.enterWarehouseDate}}
												</td>
												<td rowspan="1" colspan="2">验收日期</td>
												<!--purchaseDate-->
												<td rowspan="1">{{list.enterWarehouseDate}}</td>
											</tr>
											<tr>
												<td rowspan="1" colspan="2">{{condition.invoiceNum}}</td>
												<td rowspan="1" colspan="2"></td>
												<td rowspan="1"></td>
											</tr>
											<tr>
												<td rowspan="1" colspan="3">产品名称及规格型号</td>
												<td rowspan="1" colspan="1">单位</td>
												<td rowspan="1">数量</td>
												<td rowspan="1">单价（元）</td>
												<td rowspan="1" colspan="2">金额（元）</td>
												<td rowspan="1" colspan="2">备注</td>
											</tr>
											<tr>
												<td rowspan="1" colspan="3">{{list.carSeries}}{{list.modelName}}{{list.configureName}}</td>
												<td rowspan="1" colspan="1">辆</td>
												<td rowspan="1">-{{list.vin.length}}</td>
												<td rowspan="1">{{list.estimatePrice}}</td>
												<td rowspan="1" colspan="2">-{{(Number(list.estimatePrice)*list.vin.length).toFixed(2)}}</td>
												<td rowspan="2" colspan="2" height="94px">
													<a v-for="(lists,index) in list.vin"><span>{{lists}}<br/></span></a>
													<!--, LWVDA2030HB048255, LWVDA2036HB048406, LWVDA2036HB047319, LWVDA203XHB048182,-->
												</td>
											</tr>
											<tr>
												<td rowspan="1" colspan="2">进货发票</td>
												<td rowspan="1" colspan="6"></td>
											</tr>
										</table>
									</div>
								</el-col>
							</el-row>
							<el-row>
								<div id="" style="margin-left: %; width: 100%; float: left;">
									&nbsp;
								</div>
								<div id="" style="margin-left: 12%; width: 15%; float: left;">
									制单：{{userName}}
								</div>
								<div id="" style="margin-left: 5%; width: 20%;float: left;">
									复核:
								</div>
								<div id="" style="margin-left: 0%; width: 15%;float: left;">
									验收员：
								</div>
								<div id="" style="margin-left: 5%; width: 15%;float: left;">
									仓库主管：
								</div>
								<el-row>
									<div>
										<div style="float: left;">
											<div>
												<!--<div style="width: 300px;">
													底盘号:&nbsp;{{multipleSelection[index].vin}}
												</div>-->
											</div>
										</div>
									</div>
								</el-row>
							</el-row>
						</div>

					</font>
					<div style="height: 100px;"></div>
				</div>
			</div>
			<!--底部的注意 结束-->
			<el-row style="margin-left:5px">
				<el-col>
					<el-button type="primary" @click="saveDayinAll">点击打印</el-button>
				</el-col>
			</el-row>

		</el-dialog>

		<carserice :show="showStart" v-if="showStart" v-on:close="showStart=false" v-on:insert="insert"></carserice>
	</div>
</template>
<script>
	import carserice from '../../insPlugins/carSeries.vue'
	import moment from 'moment'
	export default {
		data: function() {
			return {
				//添加上月车辆
				lastAdd:false,
				//发票内查询条件vin
				sel_vin: "",
				//组合单据打印窗口
				printAftershow: false,
				//打印冲估单的价格
				priceCG: "",
				//单据号
				numberOrder: "",
				add_isRed: "",
				levelConvertData: {},
				//仓库简称
				levelConvertDatas: {},
				userName: "",
				//打印窗口-冲估
				dayinFormShows: false,
				//打印窗口
				dayinFormShow: false,
				//发票类型下拉
				invoiceTotalType: false,
				//列表与详情切换的标识
				tableFlog: true,
				//修改金额的form
				comFormDataPrice: {
					id: [],
					price: "",
				},
				//日期查询条件
				data: {
					firstStart: "",
					firstStarts: ""
				},
				//增加发票时的发票类型的下拉
				invoiceTypeCombo: [{
					label: '增值税普通发票',
					value: '0'
				}, {
					label: '增值税专用发票',
					value: '1'
				}],
				//发票类型的下拉
				invoiceTypeCombos: [{
					label: '增值税普通发票',
					value: '0'
				}, {
					label: '增值税专用发票',
					value: '1'
				}, {
					label: '差额红冲发票',
					value: '2'
				}, {
					label: '全额红冲发票',
					value: '3'
				}],
				//发票类型的下拉
				invoiceTypeComboa: [{
					label: '增值税普通发票',
					value: '0'
				}, {
					label: '增值税专用发票',
					value: '1'
				}],
				insuranceCombo: [{
					label: '交强险',
					value: '0'
				}, {
					label: '商业险',
					value: '1'
				}],
				commissionCombo: [{
					label: '常规佣金',
					value: '0'
				}, {
					label: '促销佣金',
					value: '1'
				}],
				//页码数
				CurentPage: 1,
				//详情页码数
				CurentPages: 1,
				//每页的数量
				page: this.page,

				//页码数
				CurentPageCar: 1,
				//每页的数量
				pageCar: this.page,
				//公司数据
				tableDataCar: {
					total: 0,
					dataList: []
				},

				//公司数据
				tableData: {
					total: 0,
					dataList: []
				},
				//佣金数据
				//分组数据
				tableDatas: {
					total: 0,
					dataList: []
				},
				activeName: 'true',
				companyName: '',
				conditions: {
					invoiceStratDate: "",
					invoiceStopDate: "",
					inputName: "",
					vin: "",
				},
				conditionsc: {
					invoiceStratDate: "",
					invoiceStopDate: "",
					inputName: "",
					vin: ""
				},
				condition: {
					invoiceUnit: "",
					invoiceNum: "",
					invoiceTotal: "",
					inputName: "",
					invoiceDate: "",
					invoiceTempTotal: "",
					invoiceId: "",
				},
				conditionCar: {
					vin: "", //
					brand: "", //品牌
					oldNum: "", //提单号
					carSeriesCode: "", //车系
					carModelCode: "", //车型
					carConfigureCode: "", //配置
					enterWarehouseNum: "",
					isRed: "1", //是否红冲车辆
					status: "1",
					financeType: "2", // 财务状态
					sInvoice: "0", //区别发票登记选车和调拨选车
				},
				conditionCars: {
					vin: "", //
					brand: "", //品牌
					oldNum: "", //提单号
					carSeriesCode: "", //车系
					carModelCode: "", //车型
					carConfigureCode: "", //配置
					enterWarehouseNum: "",
					isRed: "1", //是否红冲车辆
					status: "1",
					financeType: "2", // 财务状态
					sInvoice: "0", //区别发票登记选车和调拨选车
				},
				comFormShow: false,
				comFormShows: false,
				comFormShowAll: false,
				//校验规则
				Rule: {
					insuranceCompanyName: [{
						required: true,
						message: '请输入公司名称',
						trigger: 'blur'
					}],
					insuranceCompanyCode: [{
						required: true,
						message: '请输入公司简称',
						trigger: 'blur'
					}]
				},
				//校验规则
				Rules: {},
				comFormData: {
					relationId: "", //关联发票
					invoiceNum: "", //  发票编号
					invoiceDate: "", //  发票日期
					invoiceTotal: "", //  发票金额
					inputName: "", //  录入人员
					invoiceUnit: "", //发票单位
					invoiceType: "", //发票类型
					relationNum: "", //发票编号
				},
				emptyData: {
					relationId: "", //关联发票
					invoiceNum: "", //  发票编号
					invoiceDate: "", //  发票日期
					invoiceTotal: "", //  发票金额
					inputName: "", //  录入人员
					invoiceUnit: "", //发票单位
					invoiceType: "", //发票类型
					relationNum: "", //发票编号
				},
				comFormDatas: {
					companyId: "",
					createTime: "",
					updateUser: "",
					createUser: "",
					update: "",
					commission: "",
					id: "",
					insuranceType: "",
					commissionType: "",
					startDate: "",
					stopDate: "",
					insuranceCompanyName: "",

				},
				emptyDatas: {
					companyId: "",
					createTime: "",
					updateUser: "",
					createUser: "",
					update: "",
					commission: "",
					id: "",
					insuranceType: "",
					commissionType: "",
					startDate: "",
					stopDate: "",
					insuranceCompanyName: ""
				},
				multipleSelection: [],
				multipleSelectionIn: [],
				multipleSelections: [],
				companyId: "",
				//发票金额显示框
				editFormShow: false,
				infoId: "",
				//车系选择窗
				showStart: false,
				//车型代码 
				carModelCode: "",
				//配置的下拉
				configCombo: [],
				//车型的下拉
				modelCombo: [],
				//是否红冲车辆的下拉
				typeCombo: [{
					label: '未暂估入库车辆',
					value: '1'
				}, {
					label: '已暂估入库车辆',
					value: '2'
				}, {
					label: '红冲车辆',
					value: '4'
				}],
				//车辆状态
				carStatus: [{
					label: '采购在途',
					value: '0'
				}, {
					label: '在库',
					value: '1'
				}, {
					label: '已售',
					value: '2'
				}, {
					label: '调拨在途',
					value: '3'
				}],
				//组合打印
				printAfterList: [],
				//重估单流水号
				printAfterNumber: [],
				//正入单流水号
				printAfterNumbers: [],
				getStrat_printTime: '',
				//财务状态
				financeTypeStatus: [{
					label: '验车单已打印',
					value: '1'
				}, {
					label: '暂估入库',
					value: '2'
				}, {
					label: '正入',
					value: '3'
				}],
				//打印的仓库id
				//warehouseID:"",
				//warehouseId: [],
			}
		},
		methods: {
			//打印
			saveDayin: function() {
				//debugger;
				/*调用打印接口*/
				//用 JavaScript 实现页面数据的打印 ： 主要是用到了一个 print() 函数 ， 该函数将会打印整个 web 页面 body 内的所有 html 数据 ! 使用方法为 window.print(); 打印页面上局部的数据，则可以 用
				//把数据嵌套在 一个 div 里，获得 div				
				var newstr = document.getElementById("printHtml").innerHTML;
				var printWindow = window.open();
				printWindow.document.body.innerHTML = newstr;
				printWindow.print();
				printWindow.close();
				this.$data.dayinFormShow = false;
			},
			//打印
			saveDayinAll: function() {
				//debugger;
				/*调用打印接口*/
				//用 JavaScript 实现页面数据的打印 ： 主要是用到了一个 print() 函数 ， 该函数将会打印整个 web 页面 body 内的所有 html 数据 ! 使用方法为 window.print(); 打印页面上局部的数据，则可以 用
				//把数据嵌套在 一个 div 里，获得 div				
				var newstr = document.getElementById("printAfterHtml").innerHTML;
				var printWindow = window.open();
				printWindow.document.body.innerHTML = newstr;
				printWindow.print();
				printWindow.close();
				this.$data.printAftershow = false;
			},

			//更新流水单号
			saveNumber: function(val) {
				this.$http.get(this.API_ROOT + '/scm/common/updateSerialNumber', {
					params: {
						currentSerial: val
					}
				}).then((response) => {
					//debugger;
					//this.$data.numberOrder = response.data.serialNu;
				}, (response) => {});
			},
			//打印入库单
			prientOrder: function(val) {
				//debugger;
				if(this.$data.multipleSelections.length < 1) {
					this.$message("请选择车辆！");
				} else {
					if(val == 0) {
						//获取流水号和初次打印时间
						//循环遍历选择的车辆
						for(var i = 0; i < this.$data.multipleSelections.length; i++) {
							//现将vin改为数组
							var vinList = [];
							vinList[0] = this.$data.multipleSelections[i].vin;
							this.$data.multipleSelections[i].vin = vinList;
						};
						var fromDatePrientList = [];
						for(var i = 0; i < this.$data.multipleSelections.length; i++) {
							var fromDatePrient = {};
							fromDatePrient.carId = this.$data.multipleSelections[i].id;
							fromDatePrient.invoicesType = "2";
							fromDatePrient.invoicesPrice = -Number(this.$data.multipleSelections[i].estimatePrice);
							fromDatePrientList.push(fromDatePrient);
						};
						this.$http.post(this.API_ROOT + '/src/carInvoicePrice/selectByInvoicePrice', fromDatePrientList).then(resp => {
							//debugger;
							this.$data.printAfterNumber = resp.data;
						}, resp => {});
						//显示窗口
						this.$data.dayinFormShows = true;
						this.$data.priceCG = this.$data.multipleSelections[0].estimatePrice;
					} else if(val == 1) {
						//获取流水号和初次打印时间
						var fromDatePrientList = [];
						//循环遍历选择的车辆
						for(var i = 0; i < this.$data.multipleSelections.length; i++) {
							//现将vin改为数组
							var vinList = [];
							vinList[0] = this.$data.multipleSelections[i].vin;
							this.$data.multipleSelections[i].vin = vinList;
						};
						for(var i = 0; i < this.$data.multipleSelections.length; i++) {
							var fromDatePrient = {};
							fromDatePrient.carId = this.$data.multipleSelections[i].id;
							fromDatePrient.invoicesType = "3";
							fromDatePrient.invoicesPrice = Number(this.$data.multipleSelections[i].carPrice);
							fromDatePrientList.push(fromDatePrient);
						};
						this.$http.post(this.API_ROOT + '/src/carInvoicePrice/selectByInvoicePrice', fromDatePrientList).then(resp => {
							//debugger;
							this.$data.printAfterNumbers = resp.data;
						}, resp => {});
						debugger;
						this.$data.dayinFormShow = true;
					} else {
						if(this.$data.multipleSelections.length == 1) {
							//获取流水号和初次打印时间
							var fromDatePrientList = [];
							for(var i = 0; i < this.$data.multipleSelections.length; i++) {
								var fromDatePrient = {};
								fromDatePrient.carId = this.$data.multipleSelections[i].id;
								fromDatePrient.invoicesType = "4";
								fromDatePrient.invoicesPrice = -Number(this.$data.multipleSelections[i].estimatePrice);
								fromDatePrientList.push(fromDatePrient);
							};
							this.$http.post(this.API_ROOT + '/src/carInvoicePrice/selectByInvoicePrice', fromDatePrientList).then(resp => {
								//debugger;
								this.$data.printAfterNumber = resp.data;
							}, resp => {});

							this.$http.get(this.API_ROOT + '/scm/invoice/historyInvoicePrice', {
								params: {
									vin: this.$data.multipleSelections[0].vin
								}
							}).then((response) => {
								if(response.data.success) {
									debugger;
									this.$data.dayinFormShows = true;
									this.$data.multipleSelections[0].estimatePrice = response.data.historyPrice;
								} else {
									this.$message.error("非法操作！");
								}
								//debugger;
							}, (response) => {});
						} else {
							this.$message.error("请逐张打印！");
						}
						//this.$data.priceCG=this.$data.multipleSelections[0].estimatePrice;
					}
				}
			},
			//删除红票车辆
			deleteSave: function() {
				this.$data.conditionCar.status = "0"
				this.carQuery();
				this.$data.comFormShows = true;
			},
			//车型改变的回调
			changeModel: function(val) {
				if(val != "") {
					this.comboConfigure(val);
				}
				//debugger;
			},
			//选择车型后的回调
			comboConfigure: function(val) {
				this.$http.get(this.API_ROOT + '/base/carConfigure/combo', {
					params: {
						modelId: val
					}
				}).then((response) => {
					//debugger;
					this.$data.configCombo = response.data;
					this.$data.conditionCar.carConfigureCode = "";
					//this.$message(response.data);
				}, (response) => {});
			},
			//发出仓库代码与名称转换
			fromWarehouseCov: function(row) {
				//debugger;
				return this.$data.levelConvertData[row.warehouseId];
			},
			//发出仓库代码与名称转换
			fromWarehouseCovs: function(row, column) {
				return this.$data.levelConvertDatas[row.warehouse];
			},
			fromWarehouseCovs2: function(row, column) {
				return this.$data.levelConvertDatas[row.warehouseId];
			},
			//车系选择的回调
			insert: function(val, lable) {
				//debugger;
				this.$data.conditionCar.carSeriesCode = val;
				this.$data.carModelCode = lable;
				this.$http.get(this.API_ROOT + '/base/carModel/combo', {
					params: {
						seriesId: val
					}
				}).then((response) => {
					//debugger;
					this.$data.modelCombo = response.data;
					this.$data.conditionCar.carModelCode = "";
					this.$data.conditionCar.carConfigureCode = "";
					//this.$message(response.data);
				}, (response) => {});
			},
			//打开车型车系选择
			handleIconClick: function() {
				this.$data.showStart = true;
			},
			//状态转换
			invoiceTypeCov: function(row, column) {
				var temp = '';
				switch(row.invoiceType) {
					case '0':
						temp = "增值税普通发票";
						break;
					case '1':
						temp = '增值税专用发票';
						break;
					case "2":
						temp = '差额红冲发票';
						break;
					case "3":
						temp = '全额红冲发票';
						break;
					default:
						temp = row.invoiceType;
						break
				};
				return temp;
			},
			carStatusF: function(row) {
				var temp = "";
				switch(row.status) {
					case "0":
						temp = "采购在途";
						break;

					case "1":
						temp = "在库";
						break;

					case "2":
						temp = "已售";
						break;

					case "3":
						temp = "调拨在途";
						break;

					default:
						temp = row.conditionCar.status;
						break;
				}
			},
			//返回列表
			buckList: function() {
				this.$data.tableFlog = true;
				this.companyQuery();
			},
			//根据金额提示表格颜色
			tableRowClassName(row, index) {
				debugger;
				if(row.invoiceType == "2" || row.invoiceType == "3") {
					return 'redrowinvoice';
				} else {
					if(Number(row.invoiceTempTotal) != (Number(row.invoiceTotal) - Number(row.invoiceRedMoney))) {
						return 'dayrowinvoice';
					} else {
						return '';
					}
				}
			},
			//根据内容改变表格颜色（已销售车辆标识）
			tableRowClassNames(row, index) {
				////debugger;
				if(row.status == "2") {
					return 'saleEnd';
				} else {
					return '';
				}
			},
			//修改金额
			esitPrice: function() {
				if(this.$data.multipleSelections.length < 1) {
					this.$message("请选择车辆！");
				} else {
					//this.$data.comFormDataPrice.id = this.$data.tableDatas.dataList[index].id;
					this.$data.comFormDataPrice.price = "";
					this.$data.editFormShow = true;
				}
			},
			//移除车辆
			removeCar: function(index) {
				//debugger;
				if(this.$data.multipleSelections.length < 1) {
					this.$message("请选择车辆！");
				} else {
					this.$confirm('车辆移除后车辆将在此发票中移除并作废此车辆的冲估单和正入单，并且可以重新绑定发票!', '提示', {
						confirmButtonText: '确定移除',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						var cId = [];
						for(var i = 0; i < this.$data.multipleSelections.length; i++) {
							cId[i] = this.$data.multipleSelections[i].invoiceDetailId;
						};
						this.$http.post(this.API_ROOT + '/scm/invoice/delDetail', cId, {
							params: {
								iid: this.$data.infoId,
							}
						}).then((resp) => {
							if(resp.data.success) {
								//debugger;
								this.$message("移除成功");
								this.invoiceCarQuery();
								this.$data.condition.invoiceTempTotal = resp.data.invoiceTotal;
							} else {
								////debugger;
								this.$message.error(resp.data.msg);
							}
						}, (resp) => {});
					}).catch(() => {
						this.$message({
							type: 'info',
							message: '已取消此操作'
						});
					});
				}
			},
			//计算总金额
			mounthPrice: function() {
				//debugger;
				var mountSum = 0;
				for(var i = 0; i < this.$data.tableDatas.dataList.length; i++) {
					mountSum = mountSum + Number(this.$data.tableDatas.dataList[i].carPrice);
				};
				//debugger;
				this.$data.condition.invoiceTempTotal = mountSum.toFixed(2);;
			},
			//状态转换
			statusCov: function(row, column) {
				return row.status == "1" ? '已启用' : '已停用';
			},
			//保险类别转换
			//状态转换
			insCov: function(row, column) {
				return row.insuranceType == "1" ? '商业险' : '交强险';
			},
			//状态转换
			commCov: function(row, column) {
				return row.commissionType == "1" ? '促销佣金' : '常规佣金';
			},
			//选择框
			handleSelectionChange: function(val) {
				//debugger;
				this.$data.multipleSelection = val;
			},
			//发票选择框
			handleSelectionChangeIn: function(val) {
				//debugger;
				this.$data.multipleSelectionIn = val;
			},
			//选择框
			handleSelectionChanges: function(val) {
				debugger;
				var multip = val;
				this.$data.multipleSelections = multip.slice();
			},
			//切换tab页
			handleClick: function(tab, event) {
				//debugger;
				console.log(tab, event);
			},
			add: function() {
				this.$data.comFormData = Object.assign(this.$data.comFormData, this.$data.emptyData);
				this.$data.invoiceTotalType = false;
				this.$data.invoiceTypeCombo = this.$data.invoiceTypeComboa;
				this.$data.relationId = ""
				this.$data.comFormShow = true;
			},
			edit: function() {
				if(this.$data.multipleSelectionIn.length !=1) {
					this.$message("请选择发票！");
				}else{
					debugger;
				this.$http.get(this.API_ROOT + '/scm/invoice/info', {
						params: {
							id: this.$data.multipleSelectionIn[0].id
						}
					}).then((response) => {
						// success callback
						this.$data.comFormData = Object.assign(this.$data.comFormData, response.data.data);
					}, (response) => {
						// error callback
					});
					
				//this.$data.comFormData = Object.assign(this.$data.comFormData, this.$data.emptyData);
				this.$data.invoiceTotalType = false;
				this.$data.invoiceTypeCombo = this.$data.invoiceTypeComboa;
				this.$data.relationId = ""
				this.$data.comFormShow = true;
				}
			},
			addRed: function() {
				//debugger;
				this.$data.comFormData = Object.assign(this.$data.comFormData, this.$data.emptyData);
				this.$data.comFormData.invoiceType = "2";
				this.$data.comFormData.relationId = this.$data.condition.invoiceId;
				this.$data.comFormData.invoiceUnit = this.$data.condition.invoiceUnit;
				//关联的车票编号
				this.$data.comFormData.relationNum = this.$data.condition.invoiceNum;
				//发票类型的下拉
				this.$data.invoiceTotalType = true;
				this.$data.invoiceTypeCombo = this.$data.invoiceTypeCombos;
				this.$data.comFormShow = true;
			},
			addRedAll: function() {
				//debugger;

				this.$http({
					method: 'GET',
					url: this.API_ROOT + '/scm/invoice/existRedInvoice',
					params: {
						//invoiceNum:'fp2017123002'
						invoiceNum: this.$data.condition.invoiceNum, //condition.invoiceNum
					}

				}).then(function(resp) {
					//console.log(resp.data.status);
					this.$data.add_isRed = resp.data.status;

					if(this.$data.add_isRed) {
						this.$message.error("整冲红票已存在！");
					} else {
						//debugger;
						this.$data.comFormData = Object.assign(this.$data.comFormData, this.$data.emptyData);
						this.$data.comFormData.invoiceType = "3";
						this.$data.comFormData.relationId = this.$data.condition.invoiceId;
						this.$data.comFormData.invoiceUnit = this.$data.condition.invoiceUnit;
						//关联的车票编号
						//
						this.$data.comFormData.relationNum = this.$data.condition.invoiceNum + "_ZCHP"; //改名为：整冲红票
						//发票金额
						this.$data.comFormData.invoiceTotal = this.$data.condition.invoiceTotal;
						//发票类型的下拉
						this.$data.invoiceTotalType = true;
						this.$data.invoiceTypeCombo = this.$data.invoiceTypeCombos;
						this.$data.comFormShowAll = true;
					}
					//debugger;
					//this.$data.carSeries = resp.data;
				}, function(error) {
					// error
				});
				//debugger;
			},
			addCar: function() {
				//				this.$data.comFormDatas = Object.assign(this.$data.comFormDatas, this.$data.emptyDatas);
				//				this.$data.comFormDatas.companyId = this.$data.conditions.companyId
				//this.$data.conditionCar.status = "1"
				this.carQuery();
				this.$data.comFormShows = true;
				this.$data.lastAdd=false;
			},
			addCars: function() {
				//				this.$data.comFormDatas = Object.assign(this.$data.comFormDatas, this.$data.emptyDatas);
				//				this.$data.comFormDatas.companyId = this.$data.conditions.companyId
				//this.$data.conditionCar.status = "1"
				this.carQuery();
				this.$data.comFormShows = true;
				this.$data.lastAdd=true;
			},
			//保存金额
			saveEditPrice: function() {
				for(var i = 0; i < this.$data.multipleSelections.length; i++) {
					this.$data.comFormDataPrice.id[i] = this.$data.multipleSelections[i].vin;
				};
				this.$http.post(this.API_ROOT + '/scm/invoice/updateDetail', this.$data.comFormDataPrice.id, {
					params: {
						iid: this.$data.infoId,
						price: this.$data.comFormDataPrice.price
					}
				}).then((resp) => {
					if(resp.data.success) {
						this.$message("保存成功");
						this.$data.condition.invoiceTempTotal = resp.data.invoiceTotal;
						this.invoiceCarQuery();
					} else {
						////debugger;
						this.$message.error(resp.data.msg);
					}
				}, (response) => {});
				this.$data.editFormShow = false;
			},
			//查询发票列表
			companyQuery: function() {
				//开始时间
				this.$data.conditions.invoiceStratDate = this.momentFu(this.$data.data.firstStart);
				//结束时间
				this.$data.conditions.invoiceStopDate = this.momentFu(this.$data.data.firstStarts);
				this.$http.post(this.API_ROOT + '/scm/invoice/page', this.$data.conditions, {
					params: {
						start: this.$data.CurentPage,
						limit: this.$data.page.pageSize
					}
				}).then(resp => {
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						// es5写法
						this.$data.tableData = resp.data;
						//this.baseQuery(this.$data.curTreeDeptId);
						//this.$data.exFormShow = false;
					} else {
						////debugger;
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
			},
			//时间判断为空的封装
			momentFu: function(dt) {
				if(dt == '' || dt == null || dt == undefined) {
					return "";
				} else {
					return this.moment(dt).format("YYYY-MM-DD");
				}
			},
			//查询选择的车辆
			carQuery: function() {
				this.$http.post(this.API_ROOT + '/scm/car/list', this.$data.conditionCar, {
					params: {
						//start: this.$data.CurentPageCar,
						//limit: this.$data.pageCar.pageSize
					}
				}).then(resp => {
					this.$data.tableDataCar.dataList = resp.data;
					//debugger;
					for(var i = 0; i < this.$data.tableDataCar.dataList.length; i++) {
						this.$data.tableDataCar.dataList[i].carPrice = this.$data.tableDataCar.dataList[i].estimatePrice;
					}

				}, resp => {});
			},
			//查询发票的车辆
			invoiceCarQuery: function() {
				this.$http.get(this.API_ROOT + '/scm/invoice/pageDetail', {
					params: {
						id: this.$data.infoId,
						vin: this.$data.sel_vin,
						start: this.$data.CurentPages,
						limit: this.$data.page.pageSize
					}
				}).then(resp => {
					resp.data.total = parseInt(resp.data.total);
					this.$data.tableDatas = resp.data;
					//this.mounthPrice();
				}, resp => {});
			},
			//查看发票详情
			info: function(index) {
				this.$data.condition.invoiceId = this.$data.tableData.dataList[index].id;
				this.$data.condition.invoiceNum = this.$data.tableData.dataList[index].invoiceNum;
				this.$data.condition.invoiceDate = this.$data.tableData.dataList[index].invoiceDate;
				this.$data.condition.invoiceTotal = this.$data.tableData.dataList[index].invoiceTotal;
				this.$data.condition.inputName = this.$data.tableData.dataList[index].inputName;
				this.$data.condition.invoiceTempTotal = this.$data.tableData.dataList[index].invoiceTempTotal;
				this.$data.condition.invoiceUnit = this.$data.tableData.dataList[index].invoiceUnit;
				//debugger;
				this.$data.infoId = this.$data.tableData.dataList[index].id;
				this.invoiceCarQuery();
				this.$data.tableFlog = false;
			},
			//保存
			save: function() {
				//debugger;
				this.$data.comFormData.invoiceDate = this.momentFu(this.$data.comFormData.invoiceDate);
				this.$http.post(this.API_ROOT + '/scm/invoice/saveInvoice', this.$data.comFormData)
					.then(resp => {
						if(resp.data.success) {
							//debugger;
							this.companyQuery();
							this.$data.comFormShow = false;
							this.$message(resp.data.msg);
						} else {
							this.$message.error(resp.data.msg);
						}
					}, resp => {});
			},
			//保存红票整冲
			saveAll: function() {
				//debugger;
				this.$data.comFormData.invoiceDate = this.momentFu(this.$data.comFormData.invoiceDate);
				this.$http.post(this.API_ROOT + '/scm/invoice/saveInvoice', this.$data.comFormData, {
						params: {
							type: "1"
						}
					})
					.then(resp => {
						if(resp.data.success) {
							//debugger;
							this.companyQuery();
							this.$data.comFormShowAll = false;
							this.$message(resp.data.msg);
						} else {
							this.$message.error(resp.data.msg);
						}
					}, resp => {});
			},
			//选择的车辆保存
			saveCar: function() {
				//debugger;
				//将车辆的id清空
				/*for(var i = 0; i < this.$data.multipleSelection.length; i++) {
					this.$data.multipleSelection[i].id = ""
				};*/
				//给发票增加车辆
				this.$http.post(this.API_ROOT + '/scm/invoice/saveInvoiceDetail', this.$data.multipleSelection, {
						params: {
							id: this.$data.infoId
						}
					})
					.then(resp => {
						if(resp.data.success) {
							//debugger;
							this.invoiceCarQuery();
							this.$data.comFormShows = false;
							//调用打印方法
							//this.prientCar();
							if(this.$data.multipleSelection[0].financeType == 2) {
								this.printAfterSave();
							} else {
								this.printAfterSaves();
							}
							this.$data.condition.invoiceTempTotal = resp.data.invoiceTotal;
						} else {
							this.$message.error(resp.data.msg);
						}
					}, resp => {});
			},
			//选择的车辆保存--上月车辆
			saveCars: function() {
				//给发票增加车辆
				this.$http.post(this.API_ROOT + '/scm/invoice/saveInvoiceDetail', this.$data.multipleSelection, {
						params: {
							id: this.$data.infoId
						}
					})
					.then(resp => {
						if(resp.data.success) {
							//debugger;
							this.invoiceCarQuery();
							this.$data.comFormShows = false;
							//调用打印方法
							//this.prientCar();
							if(this.$data.multipleSelection[0].financeType == 2) {
								this.printAfterSavel();
							} else {
								this.printAfterSavesl();
							}
							this.$data.condition.invoiceTempTotal = resp.data.invoiceTotal;
						} else {
							this.$message.error(resp.data.msg);
						}
					}, resp => {});
			},

			/*打印组合单据*/
			printAfterSave: function() {
				//alert("dds");

				//声明打印的暂存变量
				var carList = [];
				//循环遍历选择的车辆
				for(var i = 0; i < this.$data.multipleSelection.length; i++) {
					//现将vin改为数组
					var vinList = [];
					vinList[0] = this.$data.multipleSelection[i].vin;
					this.$data.multipleSelection[i].vin = vinList;
					//现将车辆ID改为数组
					var IDList = [];
					IDList[0] = this.$data.multipleSelection[i].id;
					this.$data.multipleSelection[i].id = IDList;
					//设置是否同一车型，同一价格的车辆的标识
					var repeatFlog = true;
					//嵌套循环判断是否一致
					for(var j = 0; j < carList.length; j++) {
						if(carList[j].configureId == this.$data.multipleSelection[i].configureId && carList[j].estimatePrice == this.$data.multipleSelection[i].estimatePrice) {
							repeatFlog = false;
							carList[j].vin.push(this.$data.multipleSelection[i].vin[0]);
							carList[j].id.push(this.$data.multipleSelection[i].id[0]);
							break;
						}
					}
					if(repeatFlog == true) {
						carList.push(this.$data.multipleSelection[i]);
					}
				}
				for(var i = 0; i < carList.length; i++) {
					var result = [];
					if(carList[i].vin.lenght > 5) {
						for(var j = 5, len = carList[i].lenght.length; i < len; j += 5) {
							var vinSL = carList[i].vin.slice(j, j + 5)
							var carArr = carList[i];
							carArr.vin = vinSL;
							carList.push(carArr)
							// result.push(carList.slice(i,i+4));
						}
						carList[i].vin = carList[i].vin.slice(0, 5)
					}
				}
				this.$data.printAfterList = carList.slice(0);

				//this.$data.printAfterList = this.$data.multipleSelection.slice(0);
				//this.$data.printAfterList = this.$data.multipleSelection;
				/*冲估单获取流水号*/
				var fromDatePrientList = [];
				//this.$data.multipleSelectionss = this.$data.multipleSelection.slice(0);
				for(var i = 0; i < carList.length; i++) {
					var fromDatePrient = {};
					fromDatePrient.carId = carList[i].id;
					fromDatePrient.invoicesType = "2";
					fromDatePrient.invoicesPrice = -Number(carList[i].estimatePrice);
					fromDatePrientList.push(fromDatePrient);
				};
				//获取流水号和入库时间
				this.$http.post(this.API_ROOT + '/src/carInvoicePrice/batchByInvoicePrice', fromDatePrientList).then(resp => {
					//debugger;
					this.$data.printAfterNumber = resp.data;
					//debugger;
				}, resp => {});
				/*正入单获取流水号*/
				var fromDatePrientLists = [];
				//this.$data.multipleSelectionss = this.$data.multipleSelection.slice(0);
				for(var i = 0; i < carList.length; i++) {
					var fromDatePrients = {};
					fromDatePrients.carId = carList[i].id;
					fromDatePrients.invoicesType = "3";
					fromDatePrients.invoicesPrice = carList[i].carPrice;
					fromDatePrientLists.push(fromDatePrients);
				};
				//获取流水号和入库时间
				this.$http.post(this.API_ROOT + '/src/carInvoicePrice/batchByInvoicePrice', fromDatePrientLists).then(resps => {
					//debugger;
					this.$data.printAfterNumbers = resps.data;
					//debugger;
				}, resp => {});
				this.$data.printAftershow = true;
				//debugger;
			},
			/*打印组合单据--上月*/ 
			printAfterSavel: function() {
				//alert("dds");

				//声明打印的暂存变量
				var carList = [];
				//循环遍历选择的车辆
				for(var i = 0; i < this.$data.multipleSelection.length; i++) {
					//现将vin改为数组
					var vinList = [];
					vinList[0] = this.$data.multipleSelection[i].vin;
					this.$data.multipleSelection[i].vin = vinList;
					//现将车辆ID改为数组
					var IDList = [];
					IDList[0] = this.$data.multipleSelection[i].id;
					this.$data.multipleSelection[i].id = IDList;
					//设置是否同一车型，同一价格的车辆的标识
					var repeatFlog = true;
					//嵌套循环判断是否一致
					for(var j = 0; j < carList.length; j++) {
						if(carList[j].configureId == this.$data.multipleSelection[i].configureId && carList[j].estimatePrice == this.$data.multipleSelection[i].estimatePrice) {
							repeatFlog = false;
							carList[j].vin.push(this.$data.multipleSelection[i].vin[0]);
							carList[j].id.push(this.$data.multipleSelection[i].id[0]);
							break;
						}
					}
					if(repeatFlog == true) {
						carList.push(this.$data.multipleSelection[i]);
					}
				}
				for(var i = 0; i < carList.length; i++) {
					var result = [];
					if(carList[i].vin.lenght > 5) {
						for(var j = 5, len = carList[i].lenght.length; i < len; j += 5) {
							var vinSL = carList[i].vin.slice(j, j + 5)
							var carArr = carList[i];
							carArr.vin = vinSL;
							carList.push(carArr)
							// result.push(carList.slice(i,i+4));
						}
						carList[i].vin = carList[i].vin.slice(0, 5)
					}
				}
				this.$data.printAfterList = carList.slice(0);

				//this.$data.printAfterList = this.$data.multipleSelection.slice(0);
				//this.$data.printAfterList = this.$data.multipleSelection;
				/*冲估单获取流水号*/
				var fromDatePrientList = [];
				//this.$data.multipleSelectionss = this.$data.multipleSelection.slice(0);
				for(var i = 0; i < carList.length; i++) {
					var fromDatePrient = {};
					fromDatePrient.carId = carList[i].id;
					fromDatePrient.invoicesType = "2";
					fromDatePrient.flag = false;
					fromDatePrient.invoicesPrice = -Number(carList[i].estimatePrice);
					fromDatePrientList.push(fromDatePrient);
				};
				//获取流水号和入库时间
				this.$http.post(this.API_ROOT + '/src/carInvoicePrice/batchByInvoicePrice', fromDatePrientList).then(resp => {
					//debugger;
					this.$data.printAfterNumber = resp.data;
					//debugger;
				}, resp => {});
				/*正入单获取流水号*/
				var fromDatePrientLists = [];
				//this.$data.multipleSelectionss = this.$data.multipleSelection.slice(0);
				for(var i = 0; i < carList.length; i++) {
					var fromDatePrients = {};
					fromDatePrients.carId = carList[i].id;
					fromDatePrients.invoicesType = "3";
					fromDatePrients.flag = false;
					fromDatePrients.invoicesPrice = carList[i].carPrice;
					fromDatePrientLists.push(fromDatePrients);
				};
				//获取流水号和入库时间
				this.$http.post(this.API_ROOT + '/src/carInvoicePrice/batchByInvoicePrice', fromDatePrientLists).then(resps => {
					//debugger;
					this.$data.printAfterNumbers = resps.data;
					//debugger;
				}, resp => {});
				this.$data.printAftershow = true;
				//debugger;
			},
			//打印单据为暂估直接发票入库
			printAfterSaves: function() {

				//声明打印的暂存变量
				var carList = [];
				//循环遍历选择的车辆
				for(var i = 0; i < this.$data.multipleSelection.length; i++) {
					//现将vin改为数组
					var vinList = [];
					vinList[0] = this.$data.multipleSelection[i].vin;
					this.$data.multipleSelection[i].vin = vinList;
					//现将车辆ID改为数组
					var IDList = [];
					IDList[0] = this.$data.multipleSelection[i].id;
					this.$data.multipleSelection[i].id = IDList;
					//设置是否同一车型，同一价格的车辆的标识
					var repeatFlog = true;
					//嵌套循环判断是否一致
					for(var j = 0; j < carList.length; j++) {
						if(carList[j].configureId == this.$data.multipleSelection[i].configureId && carList[j].estimatePrice == this.$data.multipleSelection[i].estimatePrice) {
							repeatFlog = false;
							carList[j].vin.push(this.$data.multipleSelection[i].vin[0]);
							carList[j].id.push(this.$data.multipleSelection[i].id[0]);
							break;
						}
					}
					if(repeatFlog == true) {
						carList.push(this.$data.multipleSelection[i]);
					}
				}
				for(var i = 0; i < carList.length; i++) {
					var result = [];
					if(carList[i].vin.lenght > 5) {
						for(var j = 5, len = carList[i].lenght.length; i < len; j += 5) {
							var vinSL = carList[i].vin.slice(j, j + 5)
							var carArr = carList[i];
							carArr.vin = vinSL;
							carList.push(carArr)
							// result.push(carList.slice(i,i+4));
						}
						carList[i].vin = carList[i].vin.slice(0, 5)
					}
				}
				debugger;

				this.$data.multipleSelections = carList.slice(0);

				//获取流水号和初次打印时间
				var fromDatePrientList = [];
				//this.$data.multipleSelections = this.$data.multipleSelection.slice(0);
				for(var i = 0; i < carList.length; i++) {
					var fromDatePrient = {};
					fromDatePrient.carId = carList[i].id;
					fromDatePrient.invoicesType = "3";
					fromDatePrient.invoicesPrice = Number(carList[i].carPrice);
					fromDatePrientList.push(fromDatePrient);
				};
				this.$http.post(this.API_ROOT + '/src/carInvoicePrice/batchByInvoicePrice', fromDatePrientList).then(resp => {
					//debugger;
					this.$data.printAfterNumbers = resp.data;
				}, resp => {});
				this.$data.dayinFormShow = true;
			},
			//打印单据为暂估直接发票入库--上月车辆
			printAfterSavesl: function() {
				//声明打印的暂存变量
				var carList = [];
				//循环遍历选择的车辆
				for(var i = 0; i < this.$data.multipleSelection.length; i++) {
					//现将vin改为数组
					var vinList = [];
					vinList[0] = this.$data.multipleSelection[i].vin;
					this.$data.multipleSelection[i].vin = vinList;
					//现将车辆ID改为数组
					var IDList = [];
					IDList[0] = this.$data.multipleSelection[i].id;
					this.$data.multipleSelection[i].id = IDList;
					//设置是否同一车型，同一价格的车辆的标识
					var repeatFlog = true;
					//嵌套循环判断是否一致
					for(var j = 0; j < carList.length; j++) {
						if(carList[j].configureId == this.$data.multipleSelection[i].configureId && carList[j].estimatePrice == this.$data.multipleSelection[i].estimatePrice) {
							repeatFlog = false;
							carList[j].vin.push(this.$data.multipleSelection[i].vin[0]);
							carList[j].id.push(this.$data.multipleSelection[i].id[0]);
							break;
						}
					}
					if(repeatFlog == true) {
						carList.push(this.$data.multipleSelection[i]);
					}
				}
				for(var i = 0; i < carList.length; i++) {
					var result = [];
					if(carList[i].vin.lenght > 5) {
						for(var j = 5, len = carList[i].lenght.length; i < len; j += 5) {
							var vinSL = carList[i].vin.slice(j, j + 5)
							var carArr = carList[i];
							carArr.vin = vinSL;
							carList.push(carArr)
							// result.push(carList.slice(i,i+4));
						}
						carList[i].vin = carList[i].vin.slice(0, 5)
					}
				}
				debugger;

				this.$data.multipleSelections = carList.slice(0);

				//获取流水号和初次打印时间
				var fromDatePrientList = [];
				//this.$data.multipleSelections = this.$data.multipleSelection.slice(0);
				for(var i = 0; i < carList.length; i++) {
					var fromDatePrient = {};
					fromDatePrient.carId = carList[i].id;
					fromDatePrient.invoicesType = "3";
					fromDatePrient.flag = false;
					fromDatePrient.invoicesPrice = Number(carList[i].carPrice);
					fromDatePrientList.push(fromDatePrient);
				};
				this.$http.post(this.API_ROOT + '/src/carInvoicePrice/batchByInvoicePrice', fromDatePrientList).then(resp => {
					//debugger;
					this.$data.printAfterNumbers = resp.data;
				}, resp => {});
				this.$data.dayinFormShow = true;
			},
			//红票选择的车辆删除
			deleteCar: function() {
				//debugger;
				//将车辆的id清空
				let delFunct = this;
				this.$confirm('删除不可恢复，确认要删除这些数据吗?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(function() {
					//alert("ewrewrwer");
					//debugger;
					delFunct.delfun();
				}).catch(function() {
					//					this.$message({
					//						type: 'info',
					//						message: '已取消此操作'
					//					});
				});
			},
			//删除车辆
			delfun: function() {
				//debugger;
				var selId = [];
				for(var i = 0; i < this.$data.multipleSelection.length; i++) {
					selId[i] = this.$data.multipleSelection[i].id;
				};
				this.$http.post(this.API_ROOT + '/scm/invoice/delCars', selId, {
						params: {
							id: this.$data.infoId
						}
					})
					.then(resp => {
						if(resp.data.success) {
							//debugger;
							this.invoiceCarQuery();
							this.$data.comFormShows = false;
						} else {
							this.$message.error(resp.data.msg);
						}
					}, resp => {});
			},
			//列表，分页大小切换
			handleSizeChange: function() {},
			//列表,当前页切换
			handleCurrentChange: function(currentPage) {
				this.$data.CurentPage = currentPage;
				//this.$data.dictGroup = '';
				this.companyQuery();
			},
			//详情页页码切换
			handleCurrentChanges: function(currentPage) {
				this.$data.CurentPages = currentPage;
				//this.$data.dictGroup = '';
				this.invoiceCarQuery();
			},
			//列表，分页大小切换
			handleSizeChangeCar: function() {},
			//列表,当前页切换
			handleCurrentChangeCar: function(currentPage) {
				this.$data.CurentPageCar = currentPage;
				//this.$data.dictGroup = '';
				this.carQuery();
			},
			//清空查询条件
			clean: function() {
				this.$data.conditionCar = Object.assign(this.$data.conditionCar, this.$data.conditionCars);
				this.$data.carModelCode = "";
			},
			//清空查询条件
			cleans: function() {
				this.$data.data.firstStart = "";
				this.$data.data.firstStarts = "";
				this.$data.conditions = Object.assign(this.$data.conditions, this.$data.conditionsc);
			},
		},
		components: {
			carserice
		},
		//表单创建时执行
		created: function() {
			this.$data.userName = window.localStorage.getItem("userName");
			this.$http.get(this.API_ROOT + '/scm/warehouse/convert', {
				params: {}
			}).then((response) => {
				this.$data.levelConvertData = response.data;
			}, (response) => {});
			this.$http.get(this.API_ROOT + '/scm/warehouse/convertCode', {
				params: {}
			}).then((response) => {
				this.$data.levelConvertDatas = response.data;
				//this.$data.warehouseId = response.data;
				//this.$data.warehouseID = response.data;
				//发出仓库代码与名称转换

			}, (response) => {});

			//debugger;
			this.companyQuery();

		}
	}
</script>
<style>
	.el-table .info-row {
		height: 10px !important;
	}
	
	.el-table .saleEnd {
		background: #33FF66
	}
	
	.item {
		width: 30px;
	}
	
	.el-form-item {
		clear: both;
	}
	
	.el-dropdown .el-button-group,
	.el-table .el-tooltip,
	.el-table .el-tooltip__rel {
		display: inline;
	}
	
	.el-table {
		height: 100%;
		width: 100%;
	}
	
	#el-select {
		width: 200px;
	}
	
	.el-table .dayrowinvoice {
		background: #FF4949;
	}
	
	.el-table .redrowinvoice {
		background: #13CE66;
	}
	
	.el-table .table_input {
		border-style: none;
		outline: medium;
		width: 100%;
		height: 100%;
	}
</style>